package com.test.springai.config;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created with IntelliJ IDEA.
 *
 * @description:
 * @author: liuziyang
 * @since: 8/29/25 2:42 PM
 * @modifiedBy:
 * @version: 1.0
 */
@Configuration
public class McpChatClient {
  @Bean
  public ChatClient chatClientWithMcp(OllamaChatModel model, ToolCallbackProvider tools) {
    return ChatClient.builder(model)
        .defaultAdvisors(new SimpleLoggerAdvisor())
        .defaultToolCallbacks(tools)
        .build();
  }
}
